Inside Macintosh: More Macintosh Toolbox

Previous | Chapter Top | Chapter Contents | Next

Changing the Default Search Order

You can use the SetDefaultComponent function to change the order in which the list of registered components is searched.

SetDefaultComponent

The SetDefaultComponent function allows your component to change the search order for registered components. You specify a component that is to be placed at the front of the search chain, along with control information that governs the reordering operation. The order of the search chain influences which component the Component Manager selects in response to an application's use of the OpenDefaultComponent and FindNextComponent functions.

FUNCTION SetDefaultComponent (aComponent: Component;
                                         flags: Integer): OSErr;
aComponent
A component identifier that specifies the component for this operation.
flags
A value specifying the control information governing the operation. The value of this parameter controls which component description fields the Component Manager examines during the reorder operation. Set the appropriate flags to 1 to define the fields that are examined during the reorder operation. The following flags are defined:
defaultComponentIdentical
The Component Manager places the specified component in front of all other components that have the same component description.
defaultComponentAnyFlags
The Component Manager ignores the value of the componentFlags field during the reorder operation.
defaultComponentAnyManufacturer
The Component Manager ignores the value of the componentManufacturer field during the reorder operation.
defaultComponentAnySubType
The Component Manager ignores the value of the componentSubType field during the reorder operation.

DESCRIPTION

The SetDefaultComponent function changes the search order of registered components by moving the specified component to the front of the search chain, according to the value specified in the flags parameter.

SPECIAL CONSIDERATIONS

Note that the SetDefaultComponent function changes the search order for all applications. As a result, you should use this function carefully.

RESULT CODES

noErr

0

No error

invalidComponentID

-3000

No component has this component identifier


© 1997 Apple Computer, Inc.

Previous | Chapter Top | Chapter Contents | Next